use cfw_kit::ota::IDLE_ADDR;
use cfw_kit::store::{Reset, Store};
use cmsis_rtos2_rs::static_mem::MutexValue;

pub mod hx711;

#[derive(Clone, Copy)]
pub struct AppInfo {
    pub offset1: u32,
    pub offset2: u32,
    pub k1: u32,
    pub k2: u32,
}

impl Reset for AppInfo {
    fn reset(&mut self) {
        self.offset1 = 10;
        self.offset2 = 10;
        self.k1 = 10;
        self.k2 = 10;
    }
}

pub static APP_INFO: MutexValue<Store<AppInfo, IDLE_ADDR>> =
    MutexValue::uninit(Store::const_new(AppInfo {
        offset1: 10,
        offset2: 10,
        k1: 10,
        k2: 10,
    }));

pub unsafe fn init() {
    APP_INFO.init_once("app_info");
    hx711::init();
}

